


public class WhileStmt extends Statement {

	Expression expression;
	Statement statement;

	public WhileStmt(Expression expression, Statement statement) {
		super();
		this.expression = expression;
		this.statement = statement;
	}

	public void check() throws SemanticException {
		expression.check();
		if (expression.checkType() != Type.BL)
			throw new SemanticException(
					"If statement must have an expression of type boolean");
	}

	public String toString() {
		String ret = "WhileStmt\n";
		String s = "" + expression + statement;
		for (String st : s.split("\n"))
			ret += "| " + st + "\n";
		return ret;
	}
}
